package com.sy.behavioral.observer;

import java.util.ArrayList;
import java.util.List;

public class ShenTikTok extends AbstractTikTok {


    List<AbstractFans> abstractFans =  new ArrayList<>();

    void start() {
        System.out.println("我开始直播了");
        notify("大家快给我鲜花");
    }

    void end() {
        System.out.println("直播结束了");
        notify("谢谢大家的鲜花");
    }

    @Override
    void addFans(AbstractFans fans) {
        abstractFans.add(fans);
    }

    @Override
    void notify(String msg) {
        for (AbstractFans abstractFan : abstractFans ) {
            abstractFan.acceptMsg(msg);
        }
    }

}
